package com.edu.publisher.mapper;

import com.edu.publisher.beans.TradeOrderProvinceAmount;
import com.edu.publisher.beans.TradeOrderProvinceCt;
import com.edu.publisher.beans.TradeOrderSourceAmount;
import com.edu.publisher.beans.TradeOrderSourceCt;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.util.List;

public interface TradeStatsMapper {

    @Select("select provinceName,\n" +
            "       sum(orderCount) orderCount\n" +
            "from dws_trade_order_province_window\n" +
            "where toYYYYMMDD(stt) = #{date}\n" +
            "group by provinceName;")
    List<TradeOrderProvinceCt> selectTradeOrderProvinceCt(@Param("date")Integer date);

    @Select("select provinceName,\n" +
            "       sum(orderAmount) orderAmount\n" +
            "from dws_trade_order_province_window\n" +
            "where toYYYYMMDD(stt) = #{date}\n" +
            "group by provinceName;")
    List<TradeOrderProvinceAmount> selectTradeOrderProvinceAmount(@Param("date")Integer date);


    @Select("select paymentType,\n" +
            "       sum(orderCount) orderCount\n" +
            "from dws_trade_order_source_window\n" +
            "where toYYYYMMDD(stt) = #{date}\n" +
            "group by paymentType;")
    List<TradeOrderSourceCt> selectTradeOrderSourceCt(@Param("date")Integer date);


    @Select("select paymentType,\n" +
            "       sum(orderCount) orderCount\n" +
            "from dws_trade_order_source_window\n" +
            "where toYYYYMMDD(stt) = #{date}\n" +
            "group by paymentType;")
    List<TradeOrderSourceAmount> selectTradeOrderSourceAmount(@Param("date")Integer date);


}
